package com.virus.server.utils;

import java.io.*;

public class FileUtils {

    public static byte[] getBytes(File file) {
        try {
            InputStream inputStream = new FileInputStream(file);
            int available = inputStream.available();
            byte[] bytes = new byte[available];
            inputStream.read(bytes);
            return bytes;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String readUTF8(File file) throws IOException {
        InputStream inputStream = new FileInputStream(file);
        int available = inputStream.available();
        byte[] bytes = new byte[available];
        int read = inputStream.read(bytes);
        return new String(bytes, 0, read,"utf-8");
    }

}
